/*! \file MemoryMappedFile.inl
 *	\brief
 *
 *	created:	2010/11/23
 *	created:	23:11:2010   10:13
 *	filename: 	C:\src\tactics-engine\libs\io\MemoryMappedFile.inl
 *	file path:	C:\src\tactics-engine\libs\io
 *	file base:	MemoryMappedFile
 *	file ext:	inl
 *	author:		Vitalii Trubchaninov
 *				vitalii.trubchaninov@ubisoft.com
 */
namespace tt{
namespace io{

inline
MemoryMappedFile::MemoryMappedFile()
: m_ps()
{
}

inline
MemoryMappedFile::MemoryMappedFile(const std::wstring& fileMappingName)
: m_ps(fileMappingName)
{
}

inline
MemoryMappedFile::~MemoryMappedFile()
{
}

inline
bool MemoryMappedFile::Open(const std::wstring& fileName, MemoryMappedFileMode mode /*= M_READONLY*/)
{
	return m_ps.Open(fileName, mode);
}

inline
void MemoryMappedFile::Close()
{
	m_ps.Close();
}

inline
bool MemoryMappedFile::Writeable() const
{
	return m_ps.Writeable();
}

inline
size_t MemoryMappedFile::GetSize() const
{
	return m_ps.GetSize();
}

inline
const void* MemoryMappedFile::GetData() const
{
	return m_ps.Data();
}

template<typename Type>
const Type* MemoryMappedFile::GetData() const
{
	return reinterpret_cast<const Type*>( (const void*)GetData() );
}

} //namespace io
} //namespace tt
